<?php

// Namespace

namespace Loop;


// Dependencies

require_once(PATH_LOOP . 'Model/CHistory.php');


/**
 * CQuotaInstance
 *
 * @package		Loop
 * @category	Model
 */

class CQuotaInstance extends \Loop\CHistory
{	
	/**
	 *
	 */
	
	protected function createProperties()
	{
		// Create parent properties 

		parent::createProperties();
		

		$this->createProperty
		(
			'quotaId',
			array
			(
				'className' => 'CQuota',
				'extensionId' => EXTENSION_LOOP,
				'isAssociation' => true,
				'isRequired' => true
			)
		);
	}


	/**
	 *
	 */

	public function setStatus($status)
	{
		// Get the allowed status values 

		$quotaStatus = json_decode(TYPE_QUOTA_STATUS, true);

		$statusValues = $quotaStatus['values'];


		if (in_array($status, $statusValues) === false) 
		{
			e
			(
				EXCEPTION_OBJECT_PROPERTY_VALUE_NOT_VALID,
				array
				(
					'className' => $this->className,
					'propertyName' => 'status',
					'propertyValue' => $status
				)
			);
		}


		// Set the property value

		$this->setPropertyValue('status', $status);	
	}
}

?>
